const Hospital = require('../models/hospital_model')
const jsonResult = require('../utils/JSON')

// 医院信息-获取医院信息
exports.hospitalSelect = async (ctx,next) => {
    try {
        let { body } = ctx.request.body;
        let res = await Hospital.hospitalSelect(body);
        console.log(res,"hospitalSelect");
        ctx.body = jsonResult.resultSuccessJson(undefined, undefined,res)
    } catch (error) {
        console.log(error)
        ctx.body = jsonResult.resultErrorJson(undefined, undefined);
    }
}

// 医院信息-医院信息添加
exports.hospitalAdd = async (ctx)=>{
    try{
        let { body } = ctx.request.body;
        let res = await Hospital.hospitalAdd(body);
        ctx.body = jsonResult.resultSuccessJson(undefined, undefined,res)
    }catch(error){
        console.log(error);
        ctx.body = jsonResult.resultErrorJson(undefined, undefined);
    }
}
// 医院信息-医院信息修改
exports.hospitalUpdate = async (ctx)=>{
    try{
        let { body } = ctx.request.body;
        let res = await Hospital.hospitalUpdate(body);
        ctx.body = jsonResult.resultSuccessJson(undefined, undefined,res); 
    }catch(error){
        console.log(error);
        ctx.body = jsonResult.resultErrorJson(undefined, undefined);
    }
}
// 医院信息-医院信息删除
exports.hospitalDelete = async (ctx)=>{
    try{
        let { body } = ctx.request.body;
        let res = await Hospital.hospitalDelete(body);
        ctx.body = jsonResult.resultSuccessJson(undefined, undefined,res);
    }catch(error){
        console.log(error);
    }
}
